<template>
  <div class="myContainer">
    <!-- <el-row class="myBorderBottom">
      <el-col :span="24">设备台账详情</el-col>
    </el-row> -->
    <el-row class="mymarginTop_10px">
      <el-col :span="24">
        <!-- <el-tabs type="border-card">
          <el-tab-pane label="基础数据"> -->
            <el-row class="myBorderBottom">
              <el-col :span="24">
                设备基础信息
              </el-col>
            </el-row>
            <el-row class="myPaddingTop_10px">
              <el-col :span="3" class="myVA_M myLeftMsg">
                设备名称 :
              </el-col>
              <el-col :span="6">
                <el-input placeholder="设备名称" v-model="detail.dev_name" :readonly="idRead"></el-input>
              </el-col>
            </el-row>
            <el-row class="myPaddingTop_10px">
              <el-col :span="3" class="myVA_M myLeftMsg">
                设备编号 :
              </el-col>
              <el-col :span="6">
                <el-input placeholder="设备编号" v-model="detail.dev_no" :readonly="idRead"></el-input>
              </el-col>
            </el-row>
            <el-row class="myPaddingTop_10px">
              <el-col :span="3" class="myVA_M myLeftMsg">
                设备类型 :
              </el-col>
              <el-col :span="6">
                <el-input placeholder="设备类型" v-model="dev_type" :readonly="idRead"></el-input>
                <!-- <template>
                  <el-select v-model="value" placeholder="设备类型" :disabled="disabled">
                    <el-option
                      v-for="item in devTypeList"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </template> -->
              </el-col>
            </el-row>
            <el-row class="myPaddingTop_10px">
              <el-col :span="3" class="myVA_M myLeftMsg">
                所属小区 :
              </el-col>
              <el-col :span="6">
                <el-input placeholder="所属小区" v-model="detail.area_info.label" :readonly="idRead"></el-input>
                <!-- <template>
                  <el-select v-model="value" placeholder="所属小区" :disabled="disabled">
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </template> -->
              </el-col>
            </el-row>
            <el-row class="myPaddingTop_10px">
              <el-col :span="3" class="myVA_M myLeftMsg">
                所属设备房 :
              </el-col>
              <el-col :span="6">
                <el-input placeholder="所属设备房" v-model="detail.dev_room_info.label" :readonly="idRead"></el-input>
                <!-- <template>
                  <el-select v-model="value" placeholder="所属设备房" :disabled="disabled">
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </template> -->
              </el-col>
            </el-row>
            <el-row class="myBorderBottom myPaddingTop_10px">
              <el-col :span="10">
                设备出厂信息
              </el-col>
              <el-col :span="14" class="myTextAlignRight">
                <!-- <el-button type="primary" class="myBgGreen">查看设备运行参数</el-button> -->
              </el-col>
            </el-row>
            <!-- <el-row class="myPaddingTop_10px">
              <el-col :span="3" class="myVA_M myLeftMsg">
                设备型号 :
              </el-col>
              <el-col :span="6">
                <el-input placeholder="设备型号"></el-input>
              </el-col>
            </el-row> -->
            <el-row class="myPaddingTop_10px">
              <el-col :span="3" class="myVA_M myLeftMsg">
                生产日期 :
              </el-col>
              <el-col :span="6">
                <el-input placeholder="生产日期" v-model="detail.mfg_date" :readonly="idRead"></el-input>
              </el-col>
            </el-row>
            <el-row class="myPaddingTop_10px">
              <el-col :span="3" class="myVA_M myLeftMsg">
                保质到期时间 :
              </el-col>
              <el-col :span="6">
                <el-input placeholder="保质到期时间" v-model="detail.exp_date" :readonly="idRead"></el-input>
              </el-col>
            </el-row>
            <el-row class="myPaddingTop_10px">
              <el-col :span="3" class="myVA_M myLeftMsg">
                注册代码 :
              </el-col>
              <el-col :span="6">
                <el-input placeholder="注册代码" v-model="detail.bonus_code" :readonly="idRead"></el-input>
              </el-col>
            </el-row>
            <el-row class="myPaddingTop_10px">
              <el-col :span="3" class="myVA_M myLeftMsg">
                制造单位 :
              </el-col>
              <el-col :span="10">
                <el-input placeholder="制造单位" v-model="detail.mfg_company" :readonly="idRead"></el-input>
              </el-col>
            </el-row>
            <el-row class="myBorderBottom myPaddingTop_10px">
              <el-col :span="10">
                设备出厂信息
              </el-col>
            </el-row>
            <el-row class="myPaddingTop_10px">
              <el-col :span="3" class="myVA_M myLeftMsg">
                <span class="require myVA_M">*</span>
                设备状态 :
              </el-col>
              <el-col :span="10" class="myLineHeight_45px">
                <template>
                  <el-radio-group v-model="detail.status">
                    <el-radio :label="1">启用</el-radio>
                    <el-radio :label="0">禁用</el-radio>
                  </el-radio-group>
                </template>
              </el-col>
            </el-row>
            <el-row class="myPaddingTop_10px">
              <el-col :span="3" class="myVA_M myLeftMsg">
                备注 :
              </el-col>
              <el-col :span="10">
                <el-input placeholder="备注" type="textarea" v-model="detail.extra_desc" :readonly="idRead"></el-input>
              </el-col>
            </el-row>
            <el-row class="myPaddingTop_10px">
              <el-col :span="10" :offset="3">
                <el-button type="primary" class="myBgGreen" @click="onBack">关 闭</el-button>
              </el-col>
            </el-row>
          </el-tab-pane>
          <!-- <el-tab-pane label="维修记录">
            <el-row :gutter="10" class="myPaddingTop_10px">
              <el-col :span="4">
                <template>
                  <el-select v-model="housValue" placeholder="全部维修类型">
                    <el-option
                      v-for="item in housOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </template>
              </el-col>
              <el-col :span="4">
                <el-date-picker
                  v-model="value1"
                  type="date"
                  placeholder="开始日期">
                </el-date-picker>
              </el-col>
              <el-col :span="4">
                <el-date-picker
                  v-model="value1"
                  type="date"
                  placeholder="结束日期">
                </el-date-picker>
              </el-col>
              <el-col :span="4">
                <el-button type="primary" class="myBgGreen">查 询</el-button>
              </el-col>
              <el-col :span="8" class="myTextAlignRight">
                <el-button type="primary" class="myBgGreen" @click="onAdd">新增记录</el-button>
                <el-button type="primary" class="myBgGreen">导 出</el-button>
              </el-col>
            </el-row>
            <el-row class="myPaddingTop_10px">
              <el-col :span="24">
                <template>
                  <el-table
                    border
                    :data="tableData"
                    @selection-change="handleSelectionChange"
                    style="width: 100%">
                    <el-table-column
                      type="selection"
                      width="55">
                    </el-table-column>
                    <el-table-column
                      label="序号"
                      type="index"
                      width="100">
                    </el-table-column>
                    <el-table-column
                      label="时间"
                      prop="name">
                    </el-table-column>
                    <el-table-column
                      label="维修类型"
                      prop="name">
                    </el-table-column>
                    <el-table-column
                      label="维修信息描述"
                      prop="name">
                    </el-table-column>
                    <el-table-column
                      label="维修人员"
                      prop="name">
                    </el-table-column>
                    <el-table-column
                      label="联系电话"
                      prop="name">
                    </el-table-column>
                  </el-table>
                </template>
              </el-col>
            </el-row>
            <div class="block">                    
              <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="page_num"
                :page-sizes="[10, 15]"
                :page-size="page_size"
                layout="total, sizes, prev, pager, next, jumper"
                :total="total">
              </el-pagination>
            </div>
          </el-tab-pane>
          <el-tab-pane label="维保记录">
            <el-row :gutter="10" class="myPaddingTop_10px">
              <el-col :span="4">
                <el-date-picker
                  v-model="value1"
                  type="date"
                  placeholder="开始日期">
                </el-date-picker>
              </el-col>
              <el-col :span="4">
                <el-date-picker
                  v-model="value1"
                  type="date"
                  placeholder="结束日期">
                </el-date-picker>
              </el-col>
              <el-col :span="4">
                <el-button type="primary" class="myBgGreen">查 询</el-button>
              </el-col>
              <el-col :span="12" class="myTextAlignRight">
                <el-button type="primary" class="myBgGreen">导 出</el-button>
              </el-col>
            </el-row>
            <el-row class="myPaddingTop_10px">
              <el-col :span="24">
                <template>
                  <el-table
                    border
                    :data="tableData"
                    @selection-change="handleSelectionChange"
                    style="width: 100%">
                    <el-table-column
                      type="selection"
                      width="55">
                    </el-table-column>
                    <el-table-column
                      label="序号"
                      type="index"
                      width="100">
                    </el-table-column>
                    <el-table-column
                      label="时间"
                      prop="name">
                    </el-table-column>
                    <el-table-column
                      label="类型"
                      prop="name">
                    </el-table-column>
                    <el-table-column
                      label="处理人员"
                      prop="name">
                    </el-table-column>
                    <el-table-column
                      label="联系电话"
                      prop="name">
                    </el-table-column>
                    <el-table-column
                      label="维保工单"
                      prop="name">
                    </el-table-column>
                  </el-table>
                </template>
              </el-col>
            </el-row>
          </el-tab-pane>
          <el-tab-pane label="告警日志">
            <el-row :gutter="10" class="myPaddingTop_10px">
              <el-col :span="4">
                <template>
                  <el-select v-model="housValue" placeholder="全部告警类型">
                    <el-option
                      v-for="item in housOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </template>
              </el-col>
              <el-col :span="4">
                <el-date-picker
                  v-model="value1"
                  type="date"
                  placeholder="开始日期">
                </el-date-picker>
              </el-col>
              <el-col :span="4">
                <el-date-picker
                  v-model="value1"
                  type="date"
                  placeholder="结束日期">
                </el-date-picker>
              </el-col>
              <el-col :span="4">
                <el-button type="primary" class="myBgGreen">查 询</el-button>
              </el-col>
              <el-col :span="8" class="myTextAlignRight">
                <el-button type="primary" class="myBgGreen">导 出</el-button>
              </el-col>
            </el-row>
            <el-row class="myPaddingTop_10px">
              <el-col :span="24">
                <template>
                  <el-table
                    border
                    :data="tableData"
                    @selection-change="handleSelectionChange"
                    style="width: 100%">
                    <el-table-column
                      type="selection"
                      width="55">
                    </el-table-column>
                    <el-table-column
                      label="序号"
                      type="index"
                      width="100">
                    </el-table-column>
                    <el-table-column
                      label="时间"
                      prop="name">
                    </el-table-column>
                    <el-table-column
                      label="告警等级"
                      prop="name">
                    </el-table-column>
                    <el-table-column
                      label="告警详情"
                      prop="name">
                    </el-table-column>
                    <el-table-column
                      label="处理人员"
                      prop="name">
                    </el-table-column>
                    <el-table-column
                      label="联系电话"
                      prop="name">
                    </el-table-column>
                    <el-table-column
                      label="告警工单"
                      prop="name">
                    </el-table-column>
                  </el-table>
                </template>
              </el-col>
            </el-row>
          </el-tab-pane> -->
        <!-- </el-tabs> -->
      </el-col>
    </el-row>
    
    
  </div>

</template>

<style scoped>
  .myContainer{
    background: #fff;
    padding: 10px;
  }
  .myBorderBottom{
    border-bottom: 1px solid #dbdbdb;
    font-weight: 500;
    font-size: 16px;
    line-height: 40px;
  }
  .myBgGreen{
    background: #00c2a9;
    border-color: #00c2a9;
    color: #fff;
    margin-top: 2px;
  }
  .myLineHeight_35px{
    line-height: 35px;
  }
  .myTextAlignRight{
    text-align: right;
  }
  .myBgGreen:hover{
    background: #33ceba;
  }
  .myPaddingTop_10px{
    padding-top: 10px;
  }  
  .myLeftMsg{
    line-height: 40px;
    text-align: right;
    padding-right: 10px;
  }
  .myPaddingBottom_10px{
    padding-bottom: 10px;
  }
  .myVA_M{
    vertical-align: middle;
  }
  .myPadding_20px{
    padding: 20px;
  }
  .myDialogSearchText{
    width: 360px;
  }
  .myLineHeight_45px{
    line-height: 45px;    
  }
  .myOV_y_400px{
    max-height: 400px;
    min-height: 200px;
    overflow-y:scroll;
  }
  .mymarginTop_10px{
    margin-top: 10px;
  }
  .myBorderText{
    border-bottom: 1px solid #dbdbdb;
    font-weight: 500;
  }
</style>

<script>
  import { getDetail , devTypeList } from '@/api/device';
  export default {
    data(){
      return{
        value:"",
        options:[],
        disabled:true,
        radio:1,
        value1:"",
        page_num:1,
        page_size:10,
        total:null,
        tableData:[],
        housValue:"",
        housOptions:[],
        id:"",
        detail:{},
        dev_type:"",
        devTypeList:devTypeList,
        idRead:false

      }
    },
    components: {
        
    },
    filters:{
      
    },
    mounted(){
      document.title = '台账详情';
      this.id = this.$route.query.id;
      this.onGetDetail();
    },
    methods:{     
      handleSelectionChange(val) {
      },
      handleSizeChange(val) {//每页条数控制
        this.page_size = val;
      },
      handleCurrentChange(val) {//每页
        this.page_num = val;
      },
      onAdd:function(){
        this.$router.push({
          path:"/sbtzxz"
        })
      },
      onGetDetail(){
        let vm=this;
        vm.idRead=true;
        getDetail(vm.id).then(response => {
          let res=response.data;
          vm.detail=res;
          vm.dev_type=vm.onType(res.dev_type);
          console.log("ok",res)
        }).catch(error => {
          console.log(error)
        })
      },
      onBack(){
        this.$router.go(-1);
      },
      onType(val){
        return devTypeList[val];
      }

    }  
  }


</script>



